<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@ taglib  uri="http://java.sun.com/jsp/jstl/core"  prefix="c" %>  
<%@ taglib  uri="http://java.sun.com/jsp/jstl/functions"  prefix="fn" %> 
<script type="text/javascript" src="<%=request.getContextPath() %>/My97DatePicker/WdatePicker.js"></script>
<link    rel="stylesheet"    href="<%=request.getContextPath() %>/css/index3.css"  type="text/css">
<script type="text/javascript"  src="<%=request.getContextPath() %>/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript"  src="<%=request.getContextPath() %>/js/jquery.validate.js"></script> 
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>

<script type="text/javascript">

$(function () {
	$("#b").toggle(function () {
		$("input[type='checkbox']").attr("checked",true)

	},function(){
		$("input[type='checkbox']").attr("checked",false)
		
	})
})



function page(cpage) {
	$("input[name='cpage']").val(cpage)
	
	$("#a").submit()
}

function ps() {
	
	
	 var zid=$("input:checked").map(function () {
		return this.value
	}).get().join()
	
	
	alert(zid)
	
	$.post("/delall",{zid:zid},function(data){
		if(data>0){
			alert("批删成功")
			location.href="/"
		}
	},"json"
			
	)
	
		
	
}
</script>
</head>
<body>


<form action="/" id="a">
<input type="text" name="cpage" value="${page.pageNum }">
植物名<input type="text" name="zname" value="${map.zname }"><input type="submit" value="搜索">
<input type="button" value="添加"  onclick="location='/findtype'" >
</form>

<table>


	<tr>
	<td>
	<input type="checkbox" id="b">
	<input type="button" value="批删" onclick="ps()">
	
	</td>
		<td>编号</td>
		<td>植物名</td>
		<td>描述</td>
		<td>科目</td>
		<td></td>
	</tr>
	<c:forEach items="${page.list}" var="z">
	<tr>
	<td><input type="checkbox" value="${z.zid }"></td>
		<td>${z.zid }</td>
		<td>${z.zname }</td>
		<td>${z.miaoshu }</td>
		<td>${z.cname }</td>
		<td>.
		<input type="button" value="删除" onclick="location='/delbyid?zid=${z.zid}'">
		<input type="button" value="查看" onclick="location='/findzhiwu?zid=${z.zid}'">
		
		</td>
	</tr>
	</c:forEach>
	
	<tr>
	
		<td colspan="10">
		<input type="button" value="首页" onclick="page('1')">
		<input type="button" value="上一页" onclick="page('${page.pageNum-1}')">
		<input type="button" value="下一页" onclick="page('${page.pageNum+1}')">
		<input type="button" value="尾页" onclick="page('${page.pages}')">
		</td>
	</tr>
</table>

</body>
</html>